<template>
  <div class="commentList">
    <div class="info-content">
      <!-- 头部展示 -->
      <div class="info-top-title">
        <div>
          <span class="myInfo">评论列表</span
          ><span class="english"> Comment list</span>
          <span class="asd"></span>
        </div>
      </div>
        <!-- 无信息时显示 -->
        <div v-if="tableData.length ==0">
          <el-empty :image-size="300" description="您暂未评论信息"></el-empty>
        </div>
        <!-- 展示评论信息 -->
        <div class="show-comment" v-if="tableData.length !=0">
            <Table :commentDatas="tableData"></Table>
        </div>
    </div>
  </div>
</template>

<script>
import axios from "axios"
import Table from "@/components/table/table.vue"
import pubsub from "pubsub-js"
export default {
  name: "CommentList",
  components:{
    Table
  },
  data() {
      return {
        tableData: [],
      }
    },
    mounted(){
      this.selectUserArticleComment()

    },  
    methods:{
        deleteRow(commentId){
            //commentId评论id 
        },
        updateRow(commentId,currentListContent){
             //commentId评论id  currentListContent当前行数据
        },
        //查询评论信息
        selectUserArticleComment(){
          const that = this;
          axios({
              method:'get',
              url:"/aabbcc/userArticleComment/selectUserArticleComment",
              params:{
                userId:10
              }
          })
          .then(function(res){
            that.tableData = res.data.obj
            pubsub.publish("commentDatas",that.tableData)
          })
        },
    }
};
</script>

<style scoped>
.commentList {
  width: 96%;
  margin: 0 auto;
  margin-top: 20px;
  margin-bottom: 20px;
}
/*头部 */
.info-top-title {
  width: 100%;
  height: 30px;
}
.info-top-title .myInfo {
  color: #333;
  font-size: 25px;
  font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
}
.info-top-title > div {
  cursor: pointer;
  position: relative;
  padding-bottom: 10px;
  border-bottom: 1px solid #cccccc;
}
.info-top-title > div:hover .asd {
  opacity: 1;
  transform: scaleX(1);
  transition: all 0.5s linear;
}
.info-top-title .asd {
  width: 100%;
  border: 1px solid #2882c5;
  /* height: 1px; */
  /* background: red; */
  position: absolute;
  bottom: 0;
  left: 0;
  opacity: 0;
  transform: scaleX(0);
  transition: all 0.5s linear;
}
/* 展示评论信息 */
.show-comment{
    width: 100%;
    margin-top: 20px;
    color: #2882c5;
}
</style>